package hos.okhttp.convert;

import java.io.IOException;
import java.lang.reflect.Type;

import hos.http.HttpLogUtils;
import hos.http.HttpRequest;
import hos.okhttp.utils.OkHttpResponseUtils;
import okhttp3.Response;

/**
 * <p>Title: HttpConvertString </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @version : 1.0
 * @date : 2023/4/4 18:06
 */
public class HttpResponseMapListConvert extends HttpResponseConverter {
    public HttpResponseMapListConvert() {
    }

    /**
     * @noinspection unchecked
     */
    @Override
    public <D> D parseJson(HttpRequest<?> request, Type succeed, Response response) throws IOException {
        Object convertListMap = OkHttpResponseUtils.convertListMap(response);
        HttpLogUtils.responseLog(request, convertListMap.toString());
        return (D) convertListMap;
    }
}
